//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package javax.vpncrypto;

import java.security.Permission;
import java.security.PermissionCollection;
import java.util.Enumeration;
import java.util.NoSuchElementException;

final class PermissionsEnumerator implements Enumeration<Permission> {
    private Enumeration<PermissionCollection> perms;
    private Enumeration<Permission> permset;

    PermissionsEnumerator(Enumeration<PermissionCollection> var1) {
        this.perms = var1;
        this.permset = this.getNextEnumWithMore();
    }

    public synchronized boolean hasMoreElements() {
        if (this.permset == null) {
            return false;
        } else if (this.permset.hasMoreElements()) {
            return true;
        } else {
            this.permset = this.getNextEnumWithMore();
            return this.permset != null;
        }
    }

    public synchronized Permission nextElement() {
        if (this.hasMoreElements()) {
            return (Permission)this.permset.nextElement();
        } else {
            throw new NoSuchElementException("PermissionsEnumerator");
        }
    }

    private Enumeration<Permission> getNextEnumWithMore() {
        while(true) {
            if (this.perms.hasMoreElements()) {
                PermissionCollection var1 = (PermissionCollection)this.perms.nextElement();
                Enumeration var2 = var1.elements();
                if (!var2.hasMoreElements()) {
                    continue;
                }

                return var2;
            }

            return null;
        }
    }
}
